﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTServices.Entities;
using GTServices.WPF.Client.ViewModels.Entities;
using Caliburn.Micro;

namespace GTServices.WPF.Client.ViewModels.Entities
{
    public class EntityViewModelFactory
    {
        public static PropertyChangedBase GetViewModelForEntity(BaseEntity be)
        {
            if (be is Category)
            {
                return new CategoryViewModel() { Category = be as Category };
            }
            else if (be is Pattern)
            {
                return new PatternViewModel() { Pattern = be as Pattern };
            }
            else if (be is User)
            {
                throw new NotImplementedException("Cannot Create ViewModel of Entity Type: " + be.GetType().Name);  
            }
            else if (be is Language)
            {
                return new LanguageViewModel() { Language = be as Language };
            }
      
            else if (be is FileExtension)
            {
                return new FileExtensionViewModel() { FileExtension = be as FileExtension };
            }
            else if (be is FileInfo)
            {
                return new FileInfoViewModel() { FileInfo = be as FileInfo };
            }
            else if (be is MatchInfo)
            {
                throw new NotImplementedException("Cannot Create ViewModel of Entity Type: " + be.GetType().Name);
            }
            else if (be is GrepRequest)
            {
                return new GrepResultViewModel() { GrepResult = be as GrepResult }; 
            }

            return null;
        }
    }
}
